/*
 * @lc app=leetcode.cn id=1037 lang=typescript
 *
 * [1037] 有效的回旋镖
 */

// @lc code=start
function isBoomerang(points: number[][]): boolean {
    const [a, b, c] = points;

    // 坑点 点重合。。。。
    const a_tag = a.join(",");
    const b_tag = b.join(",");
    const c_tag = c.join(",");
    if (a_tag === b_tag || a_tag === c_tag || b_tag === c_tag) {
        return false;
    }

    // 90
    const xs = points.map((i) => i[0]);
    const ys = points.map((i) => i[1]);
    if (new Set(xs).size === 1 || new Set(ys).size === 1) return false;

    // tan 解法
    const tan = (a: number[], b: number[]) => {
        return (a[1] - b[1]) / (a[0] - b[0]);
    };
    return tan(a, b) !== tan(b, c);
}
// @lc code=end
